import org.w3c.dom.ls.LSOutput;

public class Test1 {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        String s = "";
        for(int i = 0; i < 10000; ++i){
            s += i;
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start);

        start = System.currentTimeMillis();
        StringBuffer sbf = new StringBuffer("");
        for(int i = 0; i < 10000; ++i){
            sbf.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println(end - start);

        start = System.currentTimeMillis();
        StringBuilder sbd = new StringBuilder();
        for(int i = 0; i < 10000; ++i){
            sbd.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println(end - start);
    }

    public static void main17(String[] args) {
        String s = "hello";
        s = s + " world";
        System.out.println(s);
    }
    public static void main16(String[] args) {
        String s1=" hello world ";
        System.out.println("["+s1+"]");
        System.out.println("["+s1.trim()+"]");
    }
    public static void main15(String[] args) {
        String s1="asdfghkj";
        System.out.println(s1.substring(6));
        System.out.println(s1.substring(0,5));
    }
    public static void main14(String[] args) {
        String s1="name=xiaomei&age=20";
        String[] result=s1.split("&");
        for (int i = 0; i < result.length; i++) {
            String[] result2=result[i].split("=");
            System.out.println(result2[0]+"="+result2[1]);
        }
    }
    public static void main13(String[] args) {
        String s1="2025.3.25";
        String[] result=s1.split("\\.");
        for (String s:result) {
            System.out.print(s+" ");
        }
    }
    public static void main12(String[] args) {
        String s1 = "hello world good morning";
        String[] result = s1.split(" ",3);
        String[] result1 = s1.split(" ",2);
        for (String s : result) {
            System.out.println(s);
        } for (String s : result1) {
            System.out.println(s);
        }
    }
    public static void main11(String[] args) {
        String s1="hello world good morning";
        String[] result=s1.split(" ");
        for (String s:result) {
            System.out.println(s);
        }

    }
    public static void main10(String[] args) {
        String s1="aaasssdddfffggg";
        System.out.println(s1.replaceAll("a","l"));
        System.out.println(s1.replaceFirst("d","k"));
        System.out.println(s1.replace("s","o"));
    }
    public static void main9(String[] args) {
        String s1=String.format("%d/%d/%d",2025,3,25);
        System.out.println(s1);
    }
    public static void main8(String[] args) {
        String s1="asdfghjkl";
        char[] ch=s1.toCharArray();
        for (int i = 0; i <ch.length ; i++) {
            System.out.print(ch[i]+" ");
        }
        System.out.println();
        String s2=new String(ch);
        System.out.println(ch);
    }
    public static void main7(String[] args) {
        String s1="asdfg";
        String s2="ADSFGG";
        System.out.println(s1.toUpperCase());
        System.out.println(s2.toLowerCase());
    }
    public static void main6(String[] args) {
        String str1=String.valueOf(12);
        String str2=String.valueOf(12.34);
        String str3=String.valueOf(true);
        System.out.println(str1);
        System.out.println(str2);
        System.out.println(str3);

    }
    public static void main5(String[] args) {
        String str1="asdfghjklertyasdfghjkl";
        System.out.println(str1.charAt(6));
        System.out.println(str1.indexOf('g'));
        System.out.println(str1.indexOf('f',2));
        System.out.println(str1.indexOf("hjk"));
        System.out.println(str1.indexOf("kl",3));
        System.out.println(str1.lastIndexOf('h'));
        System.out.println(str1.lastIndexOf('j',7));
        System.out.println(str1.lastIndexOf("hj"));
        System.out.println(str1.lastIndexOf("fg",6));
    }
    public static void main4(String[] args) {
        String str1=new String("abc");
        String str2=new String("ABC");
        String str3=new String("abCDef");
        String str4=new String("acde");
        System.out.println(str1.compareToIgnoreCase(str2));
        System.out.println(str1.compareToIgnoreCase(str3));
        System.out.println(str1.compareToIgnoreCase(str4));
    }
    public static void main3(String[] args) {
        String str1=new String("abc");
        String str2=new String("abc");
        String str3=new String("abcdef");
        String str4=new String("acde");
        System.out.println(str1.compareTo(str2));
        System.out.println(str1.compareTo(str3));
        System.out.println(str1.compareTo(str4));
    }
    public static void main2(String[] args) {
        String str1="123";
        String str2="123";
     // System.out.println(str1==str2);
       System.out.println(str1.equals(str2));
//        System.out.println("=================");
        String str3=new String("123");
        String str4=new String("123");
       System.out.println(str1.equals(str3));
     //  System.out.println(str1==str3);
      System.out.println(str3.equals(str4));
      //  System.out.println(str3==str4);
//        System.out.println("=================");
//        char[] arry1={'a','b','c','d'};
//        String str5=new String(arry1);
//        System.out.println(str5);
//        System.out.println("==================");
    }
}
